﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace UrlChecker.Setting
{
    public partial class KeywordList : Form
    {
        public string myKeywords;

        public KeywordList()
        {
            InitializeComponent();
        }

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            DataTable dt = QT.SEO.Keyword.GetKeywords();
            this.dgvKeywords.AutoGenerateColumns = false;
            this.dgvKeywords.Columns[0].DataPropertyName = "keyword";
            this.dgvKeywords.Columns[1].DataPropertyName = "guid";
            this.dgvKeywords.DataSource = dt;
        }

        private void btnSave_Click(object sender, EventArgs e)
        {
            if (this.dgvKeywords.SelectedRows.Count == 0)
            {
                MessageBox.Show("请选择关键字");
                return;
            }

            List<string> Keywords = new List<string>();
            foreach (DataGridViewRow row in this.dgvKeywords.SelectedRows) Keywords.Add(row.Cells[0].Value.ToString());

            this.myKeywords = string.Join("|", Keywords.ToArray());
            this.Close();
        }
    }
}
